<?php

namespace IDock\Insurance\QHIC\Response;

use IDock\Http\Response;
use IDock\Insurance\QHIC\Response\AllQHICResponse;
use IDock\Printer\EPolicyDownloadPrinter;
use IDock\Printer\preInquiryPrinter;

class ElecApplicationFormResponse extends AllQHICResponse
{
    /**
     * @var EPolicyDownloadPrinter $printer
     */
    public $printer = preInquiryPrinter::class;


    public function printerInit(): Response
    {
        $body = $this->getBody();

        if ($this->printer) {
            $this->printer = new $this->printer;
        }
        $status = $body['CStatus'] ?? '';
        $msg = $body['Message'] ?? '';
        if($status == '0'){
            $this->setError($msg);
            return $this;
        }
        $this->printer->argc = $body;
        return $this;
    }
}
